package com.ipet.web.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.ipet.web.TestClient;
import com.ipet.web.pojo.User;

@RestController
public class TestController {

	@Autowired
	private TestClient testClient;
	
	/**
	 * 这里调用接口
	 * @return
	 */
	@RequestMapping(value="/hello", method=RequestMethod.GET)
	public String hello(){
		String result = testClient.hello("张三");
		return result;
	}
	
	/**
	 * 测试传输对象
	 * @return
	 */
	@RequestMapping(value="/user/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
	public User getUser(@PathVariable Integer id){
		return testClient.getUser(id);
		
	}
}
